
*************************
*** Appendix material ***
*************************

** Figure B.2 - number of asylum seekers in Sweden **

import excel "refugeesSweden2000-2016.xlsx", firstrow clear

twoway bar refugees year || line refugees year, graphregion(color(white) lwidth(large))


** Figure B.3 - total number of clicks accidents articles **

use "final_dataset_accidents.dta", clear
sort municipality pubmonth

collapse views, by(pubmonth)
sort pubmonth
gen time=_n
label define date 1 "Feb15" 2 "Mar15" 3 "Apr15" 4 "May15" 5 "Jun15" 6 "Jul15" 7 "Ago15" 8 "Sep15" 9 "Oct15" 10 "Nov15" 11 "Dec15" 12 "Jan16" 13 "Feb16"
label values time date
line views time if time!=1, xlabel(2(1)13, valuelabel angle(45)) graphregion(color(white) lwidth(large))

restore


** Figure B.4 - monthly changes in clicks **

use "final_dataset.dta", clear

sort municipality pubmonth
bysort municipality: gen change_views=views-views[_n-1]
bysort municipality: gen change_norviews=norviews-norviews[_n-1]

preserve 

collapse change_views change_norviews, by(pubmonth)
sort pubmonth
gen time=_n
label define date 1 "Feb15" 2 "Mar15" 3 "Apr15" 4 "May15" 5 "Jun15" 6 "Jul15" 7 "Ago15" 8 "Sep15" 9 "Oct15" 10 "Nov15" 11 "Dec15" 12 "Jan16" 13 "Feb16"
label values time date
format norviews* %9.2f
gen new=40
twoway (area new time if time>=7 & time<=11, color(gs14) base(-40) ) (line change_views time if time!=1) (line change_norviews time if time!=1, yaxis(2)), xlabel(2(1)13, valuelabel angle(45)) graphregion(color(white) lwidth(large))

restore


** Figure B.5 - number of classified articles **

use "num_articles_classified.dta",clear
sort pubmonth
drop if pubmonth==201501 | pubmonth==.
gen time=_n
label define date 1 "Feb15" 2 "Mar15" 3 "Apr15" 4 "May15" 5 "Jun15" 6 "Jul15" 7 "Ago15" 8 "Sep15" 9 "Oct15" 10 "Nov15" 11 "Dec15" 12 "Jan16" 13 "Feb16"
label values time date

graph bar numarticle_flyk numarticle_other, over(time) graphregion(color(white) lwidth(large))


** Figure B.6 - average clicks by classified articles **

use "final_dataset_classified.dta", clear

preserve

collapse norviews, by(pubmonth flyktingar)
drop if pubmonth==.
sort pubmonth flyktingar
reshape wide norviews, i(pubmonth) j(flyktingar)
gen time=_n
label define date 1 "Feb15" 2 "Mar15" 3 "Apr15" 4 "May15" 5 "Jun15" 6 "Jul15" 7 "Ago15" 8 "Sep15" 9 "Oct15" 10 "Nov15" 11 "Dec15" 12 "Jan16" 13 "Feb16"
label values time date
replace norviews0=1000*norviews0
replace norviews1=1000*norviews1
format norviews* %9.2f
gen new=1
format new %9.2f
twoway (area new time if time>=7 & time<=11, color(gs14) )(line norviews0 time) (line norviews1 time), graphregion(color(white) lwidth(large))

restore


** Figure B.9 - average number of asylum seekers by month and by accomodation **

use "final_refugeesMunicip.dta", clear

preserve

collapse refugees ratio_refugeesABO ratio_refugeesEBO ratio_refugees, by(time)
label define date 1 "Dec14" 2 "Jan15" 3 "Feb15" 4 "Mar15" 5 "Apr15" 6 "May15" 7 "Jun15" 8 "Jul15" 9 "Ago15" 10 "Sep15" 11 "Oct15" 12 "Nov15" 13 "Dec15" 14 "Jan16" 15 "Feb16" 16 "Mar16"
label values time date
gen crisis=800

twoway (area crisis time if time>=9 & time<=13, color(gs14) ) ///
(line refugees time if time!=1 & time!=2 & time!=16, lcolor(navy)) ///
(line ratio_refugees time if time!=1 & time!=2 & time!=16, yaxis(2) lcolor(maroon) lpattern(dash)) ///
(line ratio_refugeesABO time if time!=1 & time!=2 & time!=16, yaxis(2) lpattern(shortdash)) ///
(line ratio_refugeesEBO time if time!=1 & time!=2 & time!=16, yaxis(2) lpattern(longdash)), ///
ylabel(, nogrid) xtitle("") xlabel(3(1)15, valuelabel angle(45)) ///
ytitle("Average number of asylum seekers") ytitle("Average number of asylum seekers" "per capita", axis(2)) ///
legend(label(1 "Refugee crisis") label(2 "# asylum seekers") label(3 "# asylum seekers per capita" "Total") ///
label(4 "# asylum seekers per capita" "Migration housing") label(5 "# asylum seekers per capita" "Own housing") ///
size(small) region(lwidth(none))) graphregion(color(white) lwidth(large))

restore


** Figure B.11 - estimated effect of lags and leads **

use "final_dataset.dta", clear

matrix beta=[.]
matrix se=[.]

foreach i in 2 1 {
xtreg norviews l`i'.ratio_refugees i.pubmonth, fe vce(cluster id)
matrix b=e(b)
matrix b=b[1, "l`i'.ratio_refugees"]
matrix V=e(V)
matrix V=V["l`i'.ratio_refugees", "l`i'.ratio_refugees"]
scalar v=sqrt(V[1,1])
matrix S=[v]
matrix beta=[beta,b]
matrix se=[se,S]
}

xtreg norviews ratio_refugees i.pubmonth,fe vce(cluster id)
matrix b=e(b)
matrix b=b[1, "ratio_refugees"]
matrix V=e(V)
matrix V=V["ratio_refugees", "ratio_refugees"]
scalar v=sqrt(V[1,1])
matrix S=[v]
matrix beta=[beta,b]
matrix se=[se,S]

foreach i in 1 2 3 {
xtreg norviews f`i'.ratio_refugees i.pubmonth,fe vce(cluster id)
matrix b=e(b)
matrix b=b[1, "f`i'.ratio_refugees"]
matrix V=e(V)
matrix V=V["f`i'.ratio_refugees", "f`i'.ratio_refugees"]
scalar v=sqrt(V[1,1])
matrix S=[v]
matrix beta=[beta,b]
matrix se=[se,S]
}

matrix m=[beta',se']
matrix rownames m= .  -2 -1 0 1 2 3 
matrix colnames m = beta se
matrix list m

* save matrix
mat2txt, matrix(m) saving(Table) replace 

set more off
drop _all
svmat m, names(col)

gen month=_n-4
label define date  -2 "t-2" -1 "t-1" 0 "t" 1 "t+1" 2 "t+2" 3 "t+3"  
label values month date
gen ub=beta+1.96*se
gen lb=beta-1.96*se

twoway (rcap ub lb month) (scatter beta month), xline(0, lwidth(medthick) lcolor(gs13)) graphregion(color(white) lwidth(large))


** Figure B.12 - correlation between clicks and municipality characteristics **

use "final_dataset.dta", clear

* standardize coefficients
local kommun pop_density pop land_sqkm shareSDvotes share_SDseat perc_foreign_pop income_munic median_income post_secondary opinion avg_age employrate

foreach i of local kommun {
sum `i'
bysort municipality: gen s`i'=(`i'-r(mean))/r(sd)
}

* OLS and saving coefficients in excel file coeffkommun.xlsx
xtreg norviews trend#c.spop_density trend#c.spop trend#c.sshareSDvotes trend#c.sshare_SDseat trend#c.sperc_foreign_pop trend#c.sincome_munic trend#c.smedian_income trend#c.semployrate trend#c.savg_age trend#c.sopinion trend#c.spost_secondary, fe vce(cluster id) 

* graph
preserve
import excel "coeffkommun.xlsx", firstrow clear

label define date 1 "Feb15" 2 "Mar15" 3 "Apr15" 4 "May15" 5 "Jun15" 6 "Jul15" 7 "Ago15" 8 "Sep15" 9 "Oct15" 10 "Nov15" 11 "Dec15" 12 "Jan16" 
label values time date

line pop time, yline(0, lwidth(medthick) lcolor(gs13)) graphregion(color(white) lwidth(large)) ylabel(-0.01(0.005)0.01, nogrid) xlabel(1(1)12) 
line pop_density time, yline(0, lwidth(medthick) lcolor(gs13)) graphregion(color(white) lwidth(large)) ylabel(-0.01(0.005)0.01, nogrid) xlabel(1(1)12) 
line foreign time, yline(0, lwidth(medthick) lcolor(gs13)) graphregion(color(white) lwidth(large)) ylabel(-0.01(0.005)0.01, nogrid) xlabel(1(1)12) 
line age time, yline(0, lwidth(medthick) lcolor(gs13)) graphregion(color(white) lwidth(large)) ylabel(-0.01(0.005)0.01, nogrid) xlabel(1(1)12) 
line educ time, yline(0, lwidth(medthick) lcolor(gs13)) graphregion(color(white) lwidth(large)) ylabel(-0.01(0.005)0.01, nogrid) xlabel(1(1)12) 
line profit time, yline(0, lwidth(medthick) lcolor(gs13)) graphregion(color(white) lwidth(large)) ylabel(-0.01(0.005)0.01, nogrid) xlabel(1(1)12) 
line income time, yline(0, lwidth(medthick) lcolor(gs13)) graphregion(color(white) lwidth(large)) ylabel(-0.01(0.005)0.01, nogrid) xlabel(1(1)12) 
line employ time, yline(0, lwidth(medthick) lcolor(gs13)) graphregion(color(white) lwidth(large)) ylabel(-0.01(0.005)0.01, nogrid) xlabel(1(1)12) 
line shareSDvote time, yline(0, lwidth(medthick) lcolor(gs13)) graphregion(color(white) lwidth(large)) ylabel(-0.01(0.005)0.01, nogrid) xlabel(1(1)12) 
line shareSDseat time, yline(0, lwidth(medthick) lcolor(gs13)) graphregion(color(white) lwidth(large)) ylabel(-0.01(0.005)0.01, nogrid) xlabel(1(1)12) 
line opinion time, yline(0, lwidth(medthick) lcolor(gs13)) graphregion(color(white) lwidth(large)) ylabel(-0.01(0.005)0.01, nogrid) xlabel(1(1)12) 
graph combine poptrendc.gph popdensitytrendc.gph agetrendc.gph foreigntrendc.gph educc.gph profittrendc.gph incometrendc.gph emplytrendc.gph sdvotetrendc.gph sdseattrendc.gph opiniontrendc.gph, graphregion(color(white) lwidth(large))

restore


** Figure B.13 - correlation between asylum seekers and refugees with asylum granted **

import excel "refugees2013-2016.xlsx", firstrow clear
save "refugees2013-2016.dta", replace

merge 1:1 municipality using "final_refugees.dta"

scatter comp_refugees_2014 refugees_201510, graphregion(color(white) lwidth(large))
scatter comp_refugees_2015 refugees_201510, graphregion(color(white) lwidth(large))
scatter comp_refugees_2016 refugees_201510, graphregion(color(white) lwidth(large))


** Figure B.14 - correlation between asylum seekers and refugees with granted asylum 2013 and 2014 **

use "refugees2013-2016.dta", clear

scatter comp_refugees_2013 asylum_dec2013, graphregion(color(white) lwidth(large))
scatter comp_refugees_2014 asylum_dec2014, graphregion(color(white) lwidth(large))


** Figure B.15 - average asylum seekers across municipalities with and without migration office **

use "final_dataset.dta", clear

preserve
collapse ratio_refugees, by(pubmonth migration_office)
sort migration_office pubmonth 
reshape wide ratio_refugees, i(pubmonth) j(migration_office)
sort pubmonth
gen time=_n
label define date 1 "Feb15" 2 "Mar15" 3 "Apr15" 4 "May15" 5 "Jun15" 6 "Jul15" 7 "Ago15" 8 "Sep15" 9 "Oct15" 10 "Nov15" 11 "Dec15" 12 "Jan16" 13 "Feb16"
label values time date

twoway (line ratio_refugees0 time) (line ratio_refugees1 time), graphregion(color(white) lwidth(large))

restore


** Figure B.16 - effect of refugees on clicks by percentile **

use "final_dataset.dta", clear

*graph main results
matrix beta=[.]
matrix se=[.]

foreach i in .25 .5 .75 {
qreg norviews ratio_refugees i.id i.pubmonth, vce(robust) q(`i')
matrix b=e(b)
matrix b=b[1, 1]
matrix V=e(V)
matrix V=V[1, 1]
scalar v=sqrt(V[1,1])
matrix S=[v]
matrix beta=[beta,b]
matrix se=[se,S]
}

matrix m=[beta',se']
matrix rownames m= .  25 50 75
matrix colnames m = beta se
matrix list m

* save matrix
mat2txt, matrix(m) saving(Table) replace 

set more off
drop _all
svmat m, names(col)

drop if beta==.
gen percentile=_n
label define date  1 "25th"  2 "50th" 3 "75th"  
label values  percentile date
gen ub=beta+1.96*se
gen lb=beta-1.96*se

twoway (rcap ub lb percentile) (line beta percentile)(scatter beta percentile), graphregion(color(white) lwidth(large))


** Figure B.18 - clicks across municipalities with and without migration office **

use "final_dataset.dta", clear

preserve
collapse norviews, by(pubmonth migration_office)
sort migration_office pubmonth 
reshape wide norviews, i(pubmonth) j(migration_office)
sort pubmonth
gen time=_n
label define date 1 "Feb15" 2 "Mar15" 3 "Apr15" 4 "May15" 5 "Jun15" 6 "Jul15" 7 "Ago15" 8 "Sep15" 9 "Oct15" 10 "Nov15" 11 "Dec15" 12 "Jan16" 13 "Feb16"
label values time date
replace norviews0=1000*norviews0
replace norviews1=1000*norviews1
format norviews* %9.2f

twoway (line norviews0 time) (line norviews1 time), graphregion(color(white) lwidth(large))

restore


** Figure B.19 - clicks across municipalities with different number of refugees **

use "final_dataset.dta", clear

preserve
collapse norviews, by(pubmonth treat*)
sort treat* pubmonth 
/* save results in excel file manyfew.xlsx */
import excel " manyfew.xlsx", firstrow clear
label define date 1 "Feb15" 2 "Mar15" 3 "Apr15" 4 "May15" 5 "Jun15" 6 "Jul15" 7 "Ago15" 8 "Sep15" 9 "Oct15" 10 "Nov15" 11 "Dec15" 12 "Jan16" 13 "Feb16"
label values time date
foreach i in few many manyfew fewmany {
replace norviews_`i'=1000*norviews_`i'
}

format norviews_* %9.2f
twoway (line norviews_many time) (line norviews_few time) (line norviews_manyfew time) (line norviews_fewmany time), graphregion(color(white) lwidth(large))

restore


** Figure B.20 - google trends for avpixlat **

import excel "GoogleTrends.xlsx", sheet(avpixlat) firstrow clear
reshape long pubmonth_, i(county) j(pubmonth)
rename pubmonth_ google
save "refugeesgoogle.dta", replace

use "final_dataset.dta", clear

preserve
collapse (sum) refugees pop, by(county pubmonth)
by county: gen ratio_refugees_county=refugees/pop
merge 1:1 county pubmonth using "refugeesgoogle.dta"
by county: gen time=_n
label define date 1 "Feb15" 2 "Mar15" 3 "Apr15" 4 "May15" 5 "Jun15" 6 "Jul15" 7 "Ago15" 8 "Sep15" 9 "Oct15" 10 "Nov15" 11 "Dec15" 12 "Jan16" 13 "Feb16"
label values time date
collapse google, by(manyrefugees time)
twoway (line google time if manyrefugees==0) (line google time if manyrefugees==1), graphregion(color(white) lwidth(large))
restore


** Figure B.21 - total clicks **

use "final_dataset_total.dta", clear
sort municipality pubmonth

collapse views, by(pubmonth)
sort pubmonth
gen time=_n
label define date 1 "Feb15" 2 "Mar15" 3 "Apr15" 4 "May15" 5 "Jun15" 6 "Jul15" 7 "Ago15" 8 "Sep15" 9 "Oct15" 10 "Nov15" 11 "Dec15" 12 "Jan16" 13 "Feb16"
label values time date
line views time, xlabel(1(1)13, valuelabel angle(45)) graphregion(color(white) lwidth(large))

restore


** Figure B.22 - cumulative clicks **

use "final_dataset_total.dta", clear

collapse views norviews, by(pubmonth)
cumul norviews, gen(cum)

sort pubmonth
gen time=_n
label define date 1 "Feb15" 2 "Mar15" 3 "Apr15" 4 "May15" 5 "Jun15" 6 "Jul15" 7 "Ago15" 8 "Sep15" 9 "Oct15" 10 "Nov15" 11 "Dec15" 12 "Jan16" 13 "Feb16"
label values time date
format norviews* %9.2f

line cum time, ytitle("Cumulative total clicks on refugee articles") ///
ylabel(, nogrid) xtitle("") xlabel(1(1)13, valuelabel angle(45)) graphregion(color(white) lwidth(large))


** Figure B.23 - cumulative empathic clicks **

use "final_dataset_totalclassified.dta", clear

keep if flyktingar==1
collapse views norviews, by(pubmonth)
cumul norviews, gen(cum)

sort pubmonth
gen time=_n
label define date 1 "Feb15" 2 "Mar15" 3 "Apr15" 4 "May15" 5 "Jun15" 6 "Jul15" 7 "Ago15" 8 "Sep15" 9 "Oct15" 10 "Nov15" 11 "Dec15" 12 "Jan16" 13 "Feb16"
label values time date
format norviews* %9.2f

line cum time, ytitle("Cumulative total clicks on empathic articles") ///
ylabel(, nogrid) xtitle("") xlabel(1(1)13, valuelabel angle(45)) graphregion(color(white) lwidth(large))


** Table B.1 - correlation municipality characteristics and refugees/housing **

use "final_refugeesMunicip.dta",clear

pwcorr ratio_refugees pop pop_density land_sqkm perc_foreign_pop post_secondary avg_age income_munic median_income employrate shareSDvotes share_SDseat opinion, sig star(.05) 
pwcorr housing pop pop_density land_sqkm perc_foreign_pop post_secondary avg_age income_munic median_income employrate shareSDvotes share_SDseat opinion, sig star(.05)


** Table B.2 - Parallel trend assumption **

use "final_dataset.dta", clear

gen quarter=1 if pubmonth==201502 | pubmonth==201503 | pubmonth==201504 
replace quarter=2 if pubmonth==201505 | pubmonth==201506 | pubmonth==201507 
replace quarter=3 if pubmonth==201508 | pubmonth==201509 | pubmonth==201510 | pubmonth==201511 
replace quarter=4 if pubmonth==201512 | pubmonth==201601 | pubmonth==201602

xtreg norviews ratio_refugees i.quarter#i.id i.quarter,fe vce(cluster id)
outreg2 using "tableB2.tex", keep(ratio_refugees) append

xtreg norviews ratio_refugees trend trend#idc, fe vce(cluster id)
outreg2 using "tableB2.tex", keep(ratio_refugees) replace


** Table B.3 - correlation refugees with granted asylum and asylum seekers **

use "refugees2013-2016.dta", clear
merge 1:1 municipality using "final_refugees.dta"

foreach j in 01 02 03 04 05 06 07 08 09 10 11 12{
pwcorr comp_refugees_2014 refugees_2015`j', sig star(.05)
pwcorr comp_refugees_2015 refugees_2015`j', sig star(.05)
pwcorr comp_refugees_2016 refugees_2015`j', sig star(.05)
}


** Table B.4 - results by refugees' accommodation type - IV estimation **

use "final_dataset.dta", clear

xi: ivreg norviews i.pubmonth i.id (ratio_refugeesABO=housingpc), cluster(id)
outreg2 using "tableB4.tex", keep(ratio_refugeesABO) ///
addtext(Municipality FE, X , Month FE, X ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) replace

use "final_dataset_classified.dta"

xi: reg ratio_refugeesABO housingpc i.id i.pubmonth, vce(cluster id)
predict yhatpc
gen interpc=c.yhatpc#flyktingar
xi: reg norviews yhatpc flyktingar interpc i.id i.pubmonth, vce(cluster id)
outreg2 using "tableB4.tex", keep(yhatpc flyktingar interpc) ///
addtext(Municipality FE, \checkmark , Month FE, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) append


** Table B.5 - alternative classification - IV estimation **

use "final_dataset_classified1.dta"

xi: reg ratio_refugees housing i.id i.pubmonth, vce(cluster id)
predict yhat
gen inter=c.yhat#sverige
xi: reg norviews yhat sverige inter i.id i.pubmonth, vce(cluster id)
outreg2 using "tableB5.tex", keep(yhat sverige inter) ctitle(FE) 
lincom _b[yhat]+_b[inter]

use "final_dataset_classified2.dta"

xi: reg ratio_refugees housing i.id i.pubmonth, vce(cluster id)
predict yhat
gen inter=c.yhat#wordrefugee
xi: reg norviews yhat wordrefugee inter i.id i.pubmonth, vce(cluster id)
outreg2 using "tableB5.tex", keep(yhat wordrefugee inter) ctitle(FE) append
lincom _b[yhat]+_b[inter]


** Table B.6 - Results by type of municipality **

use "final_dataset.dta", clear

* column 1
xtreg norviews ratio_refugees migration_office c.ratio_refugees#migration_office i.pubmonth, fe vce(cluster id) 
lincom ratio_refugees+c.ratio_refugees#1.migration_office
local coef=r(estimate)
local se=r(se)
outreg2 using "tableB6.tex", keep(ratio_refugees c.ratio_refugees#migration_office) ///
addtext(Municipality FE, \checkmark , Month FE, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat("coef", `coef',"se", `se', N,  e(N), R$^2$,  e(r2)) replace

* column 2
preserve
keep if treatmany==1 | treatfew==1

xtreg norviews ratio_refugees treatmany c.ratio_refugees#treatmany i.pubmonth, fe vce(cluster id)
lincom ratio_refugees+c.ratio_refugees#1.treatmany
local coef=r(estimate)
local se=r(se)
outreg2 using "tableB6.tex", keep(ratio_refugees c.ratio_refugees#treatmany) ///
addtext(Municipality FE, \checkmark , Month FE, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat("coef", `coef',"se", `se', N,  e(N), R$^2$,  e(r2)) append

restore

* column 3
preserve
keep if treatmanyfew==1 | treatfewmany==1

xtreg norviews ratio_refugees treatfewmany c.ratio_refugees#treatfewmany i.pubmonth, fe vce(cluster id)
lincom ratio_refugees+c.ratio_refugees#1.treatfewmany
local coef=r(estimate)
local se=r(se)
outreg2 using "tableB6.tex", keep(ratio_refugees c.ratio_refugees#treatfewmany) ///
addtext(Municipality FE, \checkmark , Month FE, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat("coef", `coef',"se", `se',N,  e(N), R$^2$,  e(r2)) append

restore

* column 4
xtreg norviews ratio_refugees proopinion c.ratio_refugees#proopinion i.pubmonth,fe vce(cluster id)
lincom ratio_refugees+c.ratio_refugees#1.proopinion
local coef=r(estimate)
local se=r(se)
outreg2 using "tableB6.tex", keep(ratio_refugees c.ratio_refugees#proopinion) ///
addtext(Municipality FE, \checkmark , Month FE, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat("coef", `coef',"se", `se',N,  e(N), R$^2$,  e(r2)) append


** Table B.7 - average number refugees by migration agency office **

use "final_refugeesMunicip.dta", clear

preserve
drop if time>=3 & time<=9
sum refugees refugeesABO refugeesEBO ratio_refugees if migration_office==0
sum refugees refugeesABO refugeesEBO ratio_refugeesif migration_office==1
sum refugees refugeesABO refugeesEBO ratio_refugees
restore

preserve
drop if time>=10 & time<=15
sum refugees refugeesABO refugeesEBO ratio_refugees if migration_office==0
sum refugees refugeesABO refugeesEBO ratio_refugeesif migration_office==1
sum refugees refugeesABO refugeesEBO ratio_refugees
restore


** Table B.8 - Results by type of municipality - IV estimation **

use "final_dataset.dta", clear

* column 1
gen inter1=c.ratio_refugees#migration_office
gen interIV=c.housingpc#migration_office
xi: ivreg norviews migration_office i.id i.pubmonth (ratio_refugees inter1 = housingpc interIV), cluster(id) 
outreg2 using "tableB8.tex", keep(ratio_refugees inter1) ///
addtext(Municipality FE, \checkmark , Month FE, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) replace
drop inter*

* column 2
preserve
keep if treatmany==1 | treatfew==1

gen inter2=c.ratio_refugees#treatmany
gen interIV=c.housingpc#treatmany
xi: ivreg norviews treatmany i.id i.pubmonth (ratio_refugees inter2 = housingpc interIV), cluster(id) 
outreg2 using "tableB8.tex", keep(ratio_refugees inter2) ///
addtext(Municipality FE, \checkmark , Month FE, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) append
drop inter*

restore

* column 3
preserve
keep if treatmanyfew==1 | treatfewmany==1

gen inter3=c.ratio_refugees#treatfewmany
gen interIV=c.housingpc#treatfewmany
xi: ivreg norviews treatfewmany i.id i.pubmonth (ratio_refugees inter3 = housingpc interIV), cluster(id) 
outreg2 using "tableB8.tex", keep(ratio_refugees inter3) ///
addtext(Municipality FE, \checkmark , Month FE, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) append
drop inter*

restore

* column 4
gen inter4=c.ratio_refugees#proopinion
gen interIV=c.housingpc#proopinion
xi: ivreg norviews proopinion i.id i.pubmonth (ratio_refugees inter4 = housingpc interIV), cluster(id) 
outreg2 using "tableB8.tex", keep(ratio_refugees inter4) ///
addtext(Municipality FE, \checkmark , Month FE, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) append
drop inter*


** Table B.9 - opinion pieces results **

use "final_dataset_other", clear

keep if section=="debatt" | section=="epstein" | section=="framstegsbloggen" | section=="jagdelar" | section=="sthlmimitthjarta" | section=="viktor"

xtreg norviews ratio_refugees i.pubmonth,fe vce(cluster id)
outreg2 using "tableB9.tex", keep(ratio_refugees) ctitle(both FE) replace

keep if section=="insidan" | section=="kultur-noje" | section=="livsstil" | section=="mobildnse" 

xtreg norviews ratio_refugees i.pubmonth,fe vce(cluster id)
outreg2 using "tableB9.tex", keep(ratio_refugees) ctitle(both FE) append

keep if section=="ledare"

xtreg norviews ratio_refugees i.pubmonth,fe vce(cluster id)
outreg2 using "tableB9.tex", keep(ratio_refugees) ctitle(both FE) append


** Figure C.1 - SOM use of media **

use "SOMmedia.dta", clear

graph bar often*, ///
legend(label(1 "Dagens Nyheter") label(2 "Svenska Dagbladet") label(3 "Local newspapers") ///
label(4 "Local magazines") label(5 "Sweden Radio") label(6 "Sweden Television") label(7 "Foreign newspapers") ///
label(8 "Social media") size(small) col(3)) graphregion(color(white) lwidth(large))


** Figure C.2 - SOM use of DN by age, gender, educ and income **

use "SOMmedia.dta", clear

foreach i in Gender Age Education Income{
graph bar oftena, over(`i') ytitle("") name(`i', replace) title(`i') graphregion(color(white) lwidth(large))
}
graph combine Gender Age Education Income 


** Figure C.3 - SOM media trust **

use "SOMmedia.dta", clear

graph bar trust, over(year) graphregion(color(white) lwidth(large)) ytitle("")


** Table C.1 - summary statistics church of sweden **

use "churchsurvey.dta", clear

latabstat scvolunteers weight_scactivity weight_scdonation, statistics(mean sd med n) columns(statistics) format(%9.3f) ///
tf(tableC1) replace caption(Summary statistics - Church of Sweden data)


** Table C.2 - summary statistics municipality characteristics **

use "final_municipalities.dta", clear

latabstat pop pop_density land_sqkm perc_foreign_pop post_secondary avg_age income_munic median_income ///
employrate shareSDvotes share_SDseat opinion15 opinion16, statistics(mean sd med n) columns(statistics) format(%9.3f) ///
tf(tableC2) replace caption(Summary statistics - municipality characteristics)


** Table E.1 - municipality characteristiscs by online DN traffic **

foreach i of varlist refugees refugeesABO refugeesEBO ratio_refugees pop pop_density land_sqkm perc_foreign_pop post_secondary income_munic median_income shareSDvotes share_SDseat opinion  avg_age employrate{
oneway `i' noclicks, tab
sum `i'
}

estpost ttest refugees refugeesABO refugeesEBO pop pop_density land_sqkm perc_foreign_pop post_secondary income_munic median_income share_SDseat shareSDvotes, by(noclicks) unequal
estimates store est1
estout est1, cells("mu_1(fmt(3)) mu_2(fmt(3)) b(fmt(3)) p(fmt(3))") 
esttab using "TableE1.tex", cells("mu_1(fmt(3)) mu_2(fmt(3)) b(fmt(3)) p(fmt(3))") wide noobs nonumber replace

estpost ttest ratio_refugees  opinion avg_age employrate, by(noclicks)
estimates store est2
estout est2, cells("mu_1(fmt(3)) mu_2(fmt(3)) b(fmt(3)) p(fmt(3))") 
esttab est2 using "TableE1.tex", cells("mu_1(fmt(3)) mu_2(fmt(3)) b(fmt(3)) p(fmt(3))") wide noobs nonumber append


** Figure E.1 - number of refugees by online DN traffic **

twoway kdensity refugees if noclicks==0 || kdensity refugees if noclicks==1, graphregion(color(white) lwidth(large))
twoway kdensity ratio_refugees if noclicks==0 || kdensity ratio_refugees if noclicks==1, graphregion(color(white) lwidth(large))
twoway kdensity change_ratio_refugees if noclicks==0 || kdensity change_ratio_refugees if noclicks==1, graphregion(color(white) lwidth(large))


** Table G.1 - Robustness checks functional form - clicks and refugees **

use "final_dataset_total.dta"

* total clicks
xtreg norviews ratio_refugees i.pubmonth,fe vce(cluster id)
outreg2 using "tableG1.tex", keep(ratio_refugees) replace

use "final_dataset.dta", clear

* Arellano-bond estimator
xi: xtabond2 norviews l.norviews ratio_refugees i.pubmonth, gmm(norviews ratio_refugees, lag(2 2)) iv(i.pubmonth) nolevel small twostep robust orthog
outreg2 using "tableG1.tex", keep(ratio_refugees) append

* Bootstrapped se
xtreg norviews ratio_refugees i.pubmonth,fe vce(bootstrap, rep(1000) seed(123))
outreg2 using "tableG1.tex", keep(ratio_refugees) append

* WLS
bysort municipality: gen sqrpop=pop^(1/2)
areg norviews ratio_refugees  i.pubmonth [pweight=sqrpop], absorb(id) vce(cluster id)
outreg2 using "tableG1.tex", keep(ratio_refugees) append

* 15th percentile
qreg norviews ratio_refugees i.id i.pubmonth, vce(robust) q(15)
outreg2 using "tableG1.tex", keep(ratio_refugees) append


** Table G.2 - Robustness checks functional form - articles classification results **

use "final_dataset_totalclassified.dta"

* total clicks
xi: reg norviews ratio_refugees flyktingar c.ratio_refugees#i.flyktingar i.id i.pubmonth, vce(cluster id) 
outreg2 using "tableG2.tex", keep(ratio_refugees flyktingar c.ratio_refugees#flyktingar) replace

use "final_dataset_classified.dta", clear

* Bootstrapped se
xi: reg norviews ratio_refugees flyktingar c.ratio_refugees#i.flyktingar i.id i.pubmonth, vce(bootstrap, rep(1000) seed(123)) 
outreg2 using "tableG2.tex", keep(ratio_refugees flyktingar c.ratio_refugees#flyktingar) append

* WLS
areg norviews ratio_refugees flyktingar inter i.pubmonth [pweight=sqrpop], absorb(id) vce(cluster id)
outreg2 using "tableG2.tex", keep(ratio_refugees flyktingar c.ratio_refugees#flyktingar) append


** Table G.3 - Robustness checks - clicks and refugees **

use "final_dataset.dta", clear

* drop stockholm 
drop if municipality=="Stockholm"
xtreg norviews ratio_refugees i.pubmonth,fe vce(cluster id)
outreg2 using "tableG3.tex", keep(ratio_refugees) append

* drop low DN use
xtreg norviews ratio_refugees i.pubmonth if nodnuse==1,fe vce(cluster id)
outreg2 using "tableG3.tex", keep(ratio_refugees) append

* local newspapers
import excel "GoogleTrends.xlsx", sheet(localmedia) firstrow clear
save "localmedia.dta", replace
merge 1:m municipality pubmonth using "localmedia.dta"

xtreg norviews ratio_refugees demand_local i.pubmonth,fe vce(cluster id)
outreg2 using "tableG3.tex", keep(ratio_refugees) append

* drop other newspaper
drop if county=="Skane lan" | county=="Vastra gotalands lan"
xtreg norviews ratio_refugees i.pubmonth,fe vce(cluster id)
outreg2 using "tableG3.tex", keep(ratio_refugees) append

* drop airports
drop if municipality=="Sigtuna" | municipality=="Harryda" | municipality=="Svedala" | municipality=="Lulea" | municipality=="Umea" | municipality=="Kiruna" | municipality=="Kallinge" | municipality=="Gotland" | municipality=="Ostersund"
xtreg norviews ratio_refugees i.pubmonth,fe vce(cluster id)
outreg2 using "tableG3.tex", keep(ratio_refugees) append

* Dn demand 2014
import excel "GoogleTrends.xlsx", sheet(DN) firstrow clear
reshape long month, i(county) j(pubmonth)
rename month dnsearch14
sort county pubmonth
save "searchDN.dta", replace
merge 1:m county pubmonth using "final_dataset.dta"

xtreg norviews ratio_refugees dnsearch14 i.pubmonth,fe vce(cluster id)
outreg2 using "tableG3.tex", keep(ratio_refugees) append

* trust
reg norviews trust ratio_refugees pop pop_density land_sqkm perc_foreign_pop post_secondary avg_age income_munic median_income employrate shareSDvotes share_SDseat opinion i.pubmonth, cluster(id)
outreg2 using "tableG3.tex", keep(trust) append


** Table G.4 - Robustness checks - articles classification results **

use "final_dataset_classified.dta", clear

* drop stockholm 
drop if municipality=="Stockholm"
xi: reg norviews ratio_refugees flyktingar c.ratio_refugees#flyktingar i.id i.pubmonth, vce(cluster id)
outreg2 using "tableG4.tex", keep(ratio_refugees flyktingar c.ratio_refugees#flyktingar) replace

* drop low DN usage
xi: reg norviews ratio_refugees flyktingar c.ratio_refugees#flyktingar i.id i.pubmonth if nodnuse==1, vce(cluster id)
outreg2 using "tableG4.tex", keep(ratio_refugees flyktingar c.ratio_refugees#flyktingar) append

* local newspapers
merge 1:m municipality pubmonth using "localmedia.dta"

xi: reg norviews ratio_refugees flyktingar c.ratio_refugees#i.flyktingar demand_local i.id i.pubmonth, vce(cluster id)
outreg2 using "tableG4.tex", keep(ratio_refugees flyktingar c.ratio_refugees#flyktingar) append

* drop other newspaper
drop if county=="Skane lan" | county=="Vastra gotalands lan"
xi: reg norviews ratio_refugees flyktingar c.ratio_refugees#flyktingar i.id i.pubmonth, vce(cluster id)
outreg2 using "tableG4.tex", keep(ratio_refugees flyktingar c.ratio_refugees#flyktingar) append

* drop airports
drop if municipality=="Sigtuna" | municipality=="Harryda" | municipality=="Svedala" | municipality=="Lulea" | municipality=="Umea" | municipality=="Kiruna" | municipality=="Kallinge" | municipality=="Gotland" | municipality=="Ostersund"
xi: reg norviews ratio_refugees flyktingar c.ratio_refugees#flyktingar i.id i.pubmonth, vce(cluster id)
outreg2 using "tableG4.tex", keep(ratio_refugees flyktingar c.ratio_refugees#flyktingar) append


** Table G.6 - further rubustness checks 

use "final_dataset.dta"

drop if pubmonth>201511
xtreg norviews ratio_refugees i.pubmonth,fe vce(cluster id)
outreg2 using "tableG6.tex", keep(ratio_refugees) replace

drop if noagreement==1
xtreg norviews ratio_refugees i.pubmonth,fe vce(cluster id)
outreg2 using "tableG6.tex", keep(ratio_refugees) append

drop if municipality=="Flen" | municipality=="Hagfors" | municipality=="Ange" | municipality=="Hultsfred" | municipality=="Filipstad" | municipality=="Asele" | municipality=="Borgholm" | municipality=="Ljusnarsberg" | municipality=="Gotene" | municipality=="Norberg" | municipality=="Pajala" | municipality=="Hallefors"  
xtreg norviews ratio_refugees i.pubmonth,fe vce(cluster id)
outreg2 using "tableG6.tex", keep(ratio_refugees) append

drop if municipality=="Danderyd" | municipality=="Ekero" | municipality=="Bollebygd" | municipality=="Kavlinge" | municipality=="Lomma" | municipality=="Lund" | municipality=="Staffanstorp" | municipality=="Tyreso" | municipality=="Vallentuna" | municipality=="Varmdo" | municipality=="Vaxholm" | municipality=="Vellinge"
xtreg norviews ratio_refugees i.pubmonth,fe vce(cluster id)
outreg2 using "tableG6.tex", keep(ratio_refugees) append

use "refugees2013-2016.dta", clear
merge 1:1 municipality using "final_refugees.dta"

xtreg norviews ratio_refugees c.ratio_refugees#c.comp_refugees_2014 i.pubmonth,fe vce(cluster id)
outreg2 using "tableG6.tex", keep(ratio_refugees) append


** Table G.7 - further rubustness checks - article classification **

use "final_dataset_classified.dta"

drop if pubmonth>201511
xi: reg norviews ratio_refugees flyktingar c.ratio_refugees#flyktingar i.id i.pubmonth, vce(cluster id)
outreg2 using "tableG7.tex", keep(ratio_refugees flyktingar c.ratio_refugees#flyktingar) replace

drop if noagreement==1
xi: reg norviews ratio_refugees flyktingar c.ratio_refugees#flyktingar i.id i.pubmonth, vce(cluster id)
outreg2 using "tableG7.tex", keep(ratio_refugees flyktingar c.ratio_refugees#flyktingar) append


** Table H.1 - crisis and non-linear results **

use "final_dataset.dta"

gen crisis=1 if pubmonth>=201510 & pubmonth<=201511
replace crisis=0 if crisis==.

gen post=1 if pubmonth>=201510 & pubmonth<=201602
replace post=0 if post==.

xtreg norviews ratio_refugees i.pubmonth, fe vce(cluster id)
outreg2 using "tableH1.tex", keep(ratio_refugees) replace

xtreg norviews ratio_refugees post c.ratio_refugees#post i.pubmonth, fe vce(cluster id)
outreg2 using "tableH1.tex", keep(ratio_refugees post c.ratio_refugees#post) append

xtreg norviews ratio_refugees crisis c.ratio_refugees#crisis i.pubmonth, fe vce(cluster id)
outreg2 using "tableH1.tex", keep(ratio_refugees crisis c.ratio_refugees#crisis) append

gen refugees2=ratio_refugees^2

xtreg norviews ratio_refugees refugees2 i.pubmonth, fe vce(cluster id)
outreg2 using "tableH1.tex", keep(ratio_refugees refugees2) append

gen feb1=1 if pubmonth==201502
replace feb1=0 if pubmonth!=201502
gen mar=1 if pubmonth==201503
replace mar=0 if pubmonth!=201503
gen apr=1 if pubmonth==201504
replace apr=0 if pubmonth!=201504
gen may=1 if pubmonth==201505
replace may=0 if pubmonth!=201505
gen jun=1 if pubmonth==201506
replace jun=0 if pubmonth!=201506
gen jul=1 if pubmonth==201507
replace jul=0 if pubmonth!=201507
gen aug=1 if pubmonth==201508
replace aug=0 if pubmonth!=201508
gen sep=1 if pubmonth==201509
replace sep=0 if pubmonth!=201509
gen oct=1 if pubmonth==201510
replace oct=0 if pubmonth!=201510
gen nov=1 if pubmonth==201511
replace nov=0 if pubmonth!=201511
gen dec=1 if pubmonth==201512
replace dec=0 if pubmonth!=201512
gen jan=1 if pubmonth==201601
replace jan=0 if pubmonth!=201601

gen inter1=c.ratio_refugees#feb1
gen inter2=c.ratio_refugees#mar
gen inter3=c.ratio_refugees#apr
gen inter4=c.ratio_refugees#may
gen inter5=c.ratio_refugees#jun
gen inter6=c.ratio_refugees#jul
gen inter7=c.ratio_refugees#aug
gen inter8=c.ratio_refugees#sep
gen inter9=c.ratio_refugees#oct
gen inter10=c.ratio_refugees#nov
gen inter11=c.ratio_refugees#dec
gen inter12=c.ratio_refugees#jan

xtreg norviews inter*,fe vce(cluster id)
outreg2 using "tableH1.tex", keep(inter*) append


** Table H.2 - Results on people'e engagement **

use "churchsurvey.dta",clear
merge 1:m municipality using "final_dataset_classified.dta" 
keep if _merge==3 
sort municipality pubmonth

keep if flyktingar==1
keep if pubmonth==201503 | pubmonth==201602
bysort municipality: gen relchange_norviews=(norviews-norviews[_n-1])/norviews[_n-1]

reg scvolunteers relchange_norviews pop pop_density land_sqkm perc_foreign_pop post_secondary avg_age income_munic median_income employrate shareSDvotes share_SDseat,vce(robust)
outreg2 using "tableH2.tex", keep(relchange_norviews) ///
addtext(Municipality controls, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) replace

reg weight_scdonation relchange_norviews ratio_refugees pop pop_density land_sqkm perc_foreign_pop post_secondary avg_age income_munic median_income employrate shareSDvotes share_SDseat,vce(robust)
outreg2 using "tableH2.tex", keep(relchange_norviews) ///
addtext(Municipality controls, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) append

reg weight_scactivity relchange_norviews ratio_refugees pop pop_density land_sqkm perc_foreign_pop post_secondary avg_age income_munic median_income employrate shareSDvotes share_SDseat,vce(robust)
outreg2 using "tableH2.tex", keep(relchange_norviews) ///
addtext(Municipality controls, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) append

use "final_dataset_classified.dta",clear
keep if flyktingar==1
keep if pubmonth==201503 | pubmonth==201602
bysort municipality: gen relchange_norviews=(norviews-norviews[_n-1])/norviews[_n-1]

bysort municipality: gen change_opinion=(opinion16-opinion15)/opinion15

reg change_opinion relchange_norviews pop pop_density land_sqkm perc_foreign_pop post_secondary avg_age ///
income_munic median_income employrate shareSDvotes share_SDseat, vce(robust)
outreg2 using "tableH2.tex", keep(relchange_norviews) ///
addtext(Municipality controls, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) append


** Table H.3 - people's engagement more results **

use "churchsurvey.dta",clear
merge 1:m municipality using "final_dataset_classified.dta" 
keep if _merge==3 
sort municipality pubmonth

keep if flyktingar==1
keep if pubmonth==201503 | pubmonth==201602
bysort municipality: gen relchange_norviews=(norviews-norviews[_n-1])/norviews[_n-1]

reg scvolunteers relchange_norviews pop pop_density land_sqkm perc_foreign_pop post_secondary avg_age income_munic median_income employrate shareSDvotes share_SDseat,vce(robust)
outreg2 using "tableH3.tex", keep(relchange_norviews) ///
addtext(Municipality controls, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) replace

reg scdonation relchange_norviews ratio_refugees pop pop_density land_sqkm perc_foreign_pop post_secondary avg_age income_munic median_income employrate shareSDvotes share_SDseat,vce(robust)
outreg2 using "tableH3.tex", keep(relchange_norviews) ///
addtext(Municipality controls, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) append

reg scactivity relchange_norviews ratio_refugees pop pop_density land_sqkm perc_foreign_pop post_secondary avg_age income_munic median_income employrate shareSDvotes share_SDseat,vce(robust)
outreg2 using "tableH3.tex", keep(relchange_norviews) ///
addtext(Municipality controls, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) append

use "churchsurvey.dta",clear
merge 1:m municipality using "final_dataset_classified.dta" 
keep if _merge==3 
sort municipality pubmonth

keep if flyktingar==0
drop if municipality=="Ale" | municipality=="Askersund" | municipality=="Essunga" | municipality=="Fargelanda" | municipality=="Filipstad" | municipality=="Hagfors" | municipality=="Hogsby" | municipality=="Vindeln" | municipality=="Vellinge" | municipality=="Uppvidinge" | municipality=="Trollhattan" | municipality=="Nordmaling" | municipality=="Ockero" | municipality=="Pajala" | municipality=="Stromsund" 
keep if pubmonth==201503 | pubmonth==201602
bysort municipality: gen relchange_norviews=(norviews-norviews[_n-1])/norviews[_n-1]

reg scvolunteers relchange_norviews pop pop_density land_sqkm perc_foreign_pop post_secondary avg_age income_munic median_income employrate shareSDvotes share_SDseat,vce(robust)
outreg2 using "tableH3.tex", keep(relchange_norviews) ///
addtext(Municipality controls, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) append

reg weight_scdonation relchange_norviews ratio_refugees pop pop_density land_sqkm perc_foreign_pop post_secondary avg_age income_munic median_income employrate shareSDvotes share_SDseat,vce(robust)
outreg2 using "tableH3.tex", keep(relchange_norviews) ///
addtext(Municipality controls, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) append

reg weight_scactivity relchange_norviews ratio_refugees pop pop_density land_sqkm perc_foreign_pop post_secondary avg_age income_munic median_income employrate shareSDvotes share_SDseat,vce(robust)
outreg2 using "tableH3.tex", keep(relchange_norviews) ///
addtext(Municipality controls, \checkmark ) ///
nocon noobs noni nor2 ctitle(" ") ///
addstat(N,  e(N), R$^2$,  e(r2)) append


** Table H.4 - Results by right-wing party **

use "final_dataset.dta", clear

xtreg norviews ratio_refugees c.ratio_refugees#manySDv i.pubmonth,fe vce(cluster id)
outreg2 using "tableH4.tex", keep(ratio_refugees c.ratio_refugees#manySDv) replace

use "final_dataset_classified.dta", clear

xi: reg norviews ratio_refugees flyktingar c.ratio_refugees#manySDv i.id i.pubmonth, vce(cluster id)
outreg2 using "tableH4.tex", keep(ratio_refugees flyktingar c.ratio_refugees#manySDv) append


** Table H.5 - controlling for municipality characteristics **

use "final_dataset.dta", clear

local kommun pop_density avg_age perc_foreign_pop post_secondary income_munic median_income employrate shareSDvotes share_SDseat opinion

xtreg norviews ratio_refugees c.ratio_refugees#c.pop i.pubmonth,fe vce(cluster id)
outreg2 using "tableH5.tex", keep(ratio_refugees c.ratio_refugees#c.pop) replace

foreach i of local kommun{
xtreg norviews ratio_refugees c.ratio_refugees#c.`i' i.pubmonth,fe vce(cluster id)
outreg2 using "tableH5.tex", keep(ratio_refugees c.ratio_refugees#c.`i') append
}






